package string;

public class MatchesDemo {
    public static void main(String[] args) {
        /*
        邮箱的正确表达式:
        dan_chuanqi666@tedu.cn
        用户名@域名.后缀
        [a-zA-Z0-9_]+@[a-zA-Z0-9]+(\.[a-zA-Z]+)+
         */
        String regex ="[a-zA-Z0-9_]+@[A-Za-z0-9]+(\\.[a-zA-Z]+)+";
        String email="fan_chuanqi666@tedu.com.cn";

        boolean match =email.matches(regex);
        if(match){
                System.out.println("是邮箱");

    }else {
            System.out.println("不是邮箱");
        }
    }
}
